﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using Microsoft.Win32.SafeHandles;

namespace JasLib.Interop.Win32
{
    public static partial class USER32
    {
        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "ActivateKeyboardLayout", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern HKL ActivateKeyboardLayout([In] HKL hkl, [In] KeyboardLayoutFlags Flags);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "AllowSetForegroundWindow", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool AllowSetForegroundWindow([In] uint dwProcessId);

        /// <summary>
        /// Windows created in different threads typically process input independently of each other. That is, they have their own input states (focus, active, capture windows, key state, queue status, and so on), and their input processing is not synchronized with the input processing of other threads. By using the AttachThreadInput function, a thread can attach its input processing mechanism to another thread. Keyboard and mouse events received by both threads are processed by the thread specified by the idAttachTo parameter until the threads are detached by calling AttachThreadInput a second time and specifying FALSE for the fAttach parameter. This also allows threads to share their input states, so they can call the SetFocus function to set the keyboard focus to a window of a different thread. This also allows threads to get key-state information.
        /// 
        /// The AttachThreadInput function fails if either of the specified threads does not have a message queue. The system creates a thread's message queue when the thread makes its first call to one of the USER or GDI functions. The AttachThreadInput function also fails if a journal record hook is installed. Journal record hooks attach all input queues together.
        /// 
        /// Note that key state, which can be ascertained by calls to the GetKeyState or GetKeyboardState function, is reset after a call to AttachThreadInput. You cannot attach a thread to a thread in another desktop.
        /// </summary>
        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "AttachThreadInput", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool AttachThreadInput([In] uint idAttach, [In] uint idAttachTo, [In] bool fAttach = true);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "BlockInput", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool BlockInput([In, MarshalAs(UnmanagedType.Bool)] bool fBlockIt = true);

        [DllImport(Constants.ModuleNames.USER32, SetLastError = true, EntryPoint = "CallMsgFilterW", CharSet = CharSet.Unicode)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool CallMsgFilter([In] ref MSG msg, [In] int nCode);

        /// <param name="hhk">This parameter is ignored.</param>
        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "CallNextHookEx", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern INT_PTR CallNextHookEx(
            [In, Optional] HHOOK hhk,
            [In] int nCode,
            [In] UINT_PTR wParam,
            [In] INT_PTR lParam);

        /// <param name="hhk">This parameter is ignored.</param>
        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "CallNextHookEx", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern INT_PTR CallNextHookEx([In, Optional] HHOOK hhk, [In] HookCode nCode, [In] UINT_PTR wParam, ref CWPSTRUCT lParam);

        /// <param name="hhk">This parameter is ignored.</param>
        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "CallNextHookEx", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern INT_PTR CallNextHookEx([In, Optional] HHOOK hhk, [In] HookCode nCode, [In] UINT_PTR wParam, ref CWPRETSTRUCT lParam);

        /// <param name="hhk">This parameter is ignored.</param>
        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "CallNextHookEx", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern INT_PTR CallNextHookEx([In, Optional] HHOOK hhk, [In] HookCode nCode, [In] UINT_PTR wParam, ref MSG lParam);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "ChildWindowFromPoint", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern HWND ChildWindowFromPoint(HWND hParent, POINT Point);

        /// <summary>
        /// Determines which, if any, of the child windows belonging to the specified parent window contains the specified point. The function can ignore invisible, disabled, and transparent child windows. The search is restricted to immediate child windows. Grandchildren and deeper descendants are not searched.
        /// </summary>
        [DllImport(Constants.ModuleNames.USER32, SetLastError = true)]
        public static extern HWND ChildWindowFromPointEx(
            HWND hParent,
            POINT Point,
            ChildWindowFromPointFlags uFlags);

        [DllImport(Constants.ModuleNames.USER32, SetLastError = true, EntryPoint = "ClientToScreen")]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool ClientToScreen(HWND hWnd, ref POINT lpPoint);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "CloseDesktop", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool CloseDesktop([In] HDESK hDesktop);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "CloseGestureInfoHandle", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool CloseGestureInfoHandle([In] HGESTUREINFO hGestureInfo);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "CloseTouchInputHandle", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool CloseTouchInputHandle([In] HTOUCHINPUT hTouchInput);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "CloseWindowStation", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool CloseWindowStation([In] HWINSTA hWinSta);

        /// <param name="pDevMode">This MUST be null/zero.</param>
        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "CreateDesktopW", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern HDESK CreateDesktop(
            string lpDesktop,
            string lpszDevice,
            UINT_PTR pDevMode,
            DesktopFlags dwFlags,
            DesktopAccessRights dwDesiredAccess,
            ref SECURITY_ATTRIBUTES lpsa);

        /// <param name="pDevMode">This MUST be null/zero.</param>
        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "CreateDesktopExW", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern HDESK CreateDesktopEx(
            string lpDesktop,
            string lpszDevice,
            [In] UINT_PTR pDevMode,
            [In] DesktopFlags dwFlags,
            [In] DesktopAccessRights dwDesiredAccess,
            ref SECURITY_ATTRIBUTES lpsa,
            [In] uint ulHeapSize = 0,
            [In] UINT_PTR pvoid = default(UINT_PTR));

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "CreatePopupMenu", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern HMENU CreatePopupMenu();

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "DefRawInputProc", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern INT_PTR DefRawInputProc(
            [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex=1)] RAWINPUT[] paRawInput,
            [In] int nInput,
            [In] uint cbSizeHeader);

        /// <summary>
        /// Undocumented.
        /// </summary>
        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "DeregisterShellHookWindow", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern void DeregisterShellHookWindow(HWND hwnd);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "DestroyMenu", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool DestroyMenu(HMENU hMenu);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "DisableProcessWindowsGhosting", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern void DisableProcessWindowsGhosting();

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "EnumWindows", CharSet = CharSet.Unicode, SetLastError = true, CallingConvention = CallingConvention.Winapi)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool EnableWindow(
            [In] HWND hWnd,
            [In, MarshalAs(UnmanagedType.Bool)] bool bEnable);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "EnumWindows", CharSet = CharSet.Unicode, SetLastError = true, CallingConvention = CallingConvention.Winapi)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool EnumWindows(WNDENUMPROC lpEnumFunc, INT_PTR lParam = default(INT_PTR));

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "EnumChildWindows", CharSet = CharSet.Unicode, SetLastError = true, CallingConvention = CallingConvention.Winapi)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool EnumChildWindows(HWND hWndParent, WNDENUMPROC lpEnumFunc, INT_PTR lParam = default(INT_PTR));

        /// <summary>
        /// Convenient wrapper for EnumChildWindows Win32 function that throws an exception on failure.
        /// We couldn't make this into an iterator function because we can't escape the callstack.
        /// But we achieve at least some fluency via the filter.
        /// </summary>
        public static List<HWND> EnumChildWindows(HWND hWndParent, Func<HWND, bool> filter = null)
        {
            List<HWND> childWindowList = new List<HWND>();

            WNDENUMPROC enumProc;
            if (filter != null)
                enumProc = (hWnd, lParam) => { if (filter(hWnd)) childWindowList.Add(hWnd); return true; };
            else
                enumProc = (hWnd, lParam) => { childWindowList.Add(hWnd); return true; };

            if (!EnumChildWindows(hWndParent, enumProc, INT_PTR.Zero))
                throw new Win32Exception();
            return childWindowList;
        }

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "EnumDesktopWindows", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool EnumDesktops([In] HWINSTA hwinsta, DESKTOPENUMPROC lpEnumFunc, INT_PTR lParam = default(INT_PTR));

        /// <summary>
        /// Convenient wrapper for EnumDesktops Win32 function that throws an exception on failure.
        /// </summary>
        public static string[] EnumDesktops(HWINSTA hwinsta)
        {
            List<string> list = new List<string>();
            if (!EnumDesktops(hwinsta, (str, l) => { list.Add(str); return true; }, INT_PTR.Zero))
                throw new Win32Exception();
            return list.ToArray();
        }

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "EnumDesktopWindows", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool EnumDesktopWindows(HDESK hDesktop, WNDENUMPROC lpfn, INT_PTR lParam = default(INT_PTR));

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "EnumDisplayMonitors", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool EnumDisplayMonitors(
            [In] HDC hdc,
            [In] ref RECT lprcClip,
            [In] MONITORENUMPROC lpfnEnum,
            [In] INT_PTR lParam = default(INT_PTR));

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "EnumDisplayMonitors", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool EnumDisplayMonitors(
            [In] HDC hdc,
            [In] INT_PTR lprcClip,
            [In] MONITORENUMPROC lpfnEnum,
            [In] INT_PTR lParam = default(INT_PTR));

        /// <summary>
        /// Convenient wrapper for the Win32 EnumDisplayMonitors API.
        /// </summary>
        public static Dictionary<HMONITOR, RECT> EnumDisplayMonitors()
        {
            Dictionary<HMONITOR, RECT> monitors = new Dictionary<HMONITOR, RECT>();
            if (!EnumDisplayMonitors(HDC.NULL, INT_PTR.Zero, (HMONITOR hMonitor, HDC hdcMonitor, ref RECT lprcMonitor, UINT_PTR dwData) => { monitors.Add(hMonitor, lprcMonitor); return true; }, INT_PTR.Zero))
                throw new Win32Exception();
            return monitors;
        }

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "ExitWindowsEx", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool ExitWindowsEx([In] ExitWindowsFlags uFlags, [In] ShutdownReason dwReason);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "EnumThreadWindows", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool EnumThreadWindows(uint dwThreadId, WNDENUMPROC lpfn, INT_PTR lParam = default(INT_PTR));

        /// <summary>
        /// Convenient wrapper for EnumThreadWindows Win32 function that throws an exception on failure.
        /// </summary>
        public static HWND[] EnumThreadWindows(uint dwThreadId)
        {
            List<HWND> list = new List<HWND>();
            if (!EnumThreadWindows(dwThreadId, (hwnd, lParam) => { list.Add(hwnd); return true; }, INT_PTR.Zero))
                throw new Win32Exception();
            return list.ToArray();
        }

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "FindWindowW", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern HWND FindWindow([In] string lpszClass = null, [In] string lpszWindow = null);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "FindWindowExW", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern HWND FindWindowEx([In] HWND hwndParent = default(HWND), [In] HWND hwndChildAfter = default(HWND), [In] string lpszClass = null, [In] string lpszWindow = null);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "FlashWindow", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool FlashWindow(
            [In] HWND hWnd,
            [In, MarshalAs(UnmanagedType.Bool)] bool bInvert);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "FlashWindowEx", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool FlashWindowEx([In] ref FLASHWINFO pfwi);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "GetActiveWindow", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern HWND GetActiveWindow();

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "GetAncestor", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern HWND GetAncestor([In] HWND hwnd, [In] GetAncestorCode gaFlags);

        [DllImport(Constants.ModuleNames.USER32, SetLastError = true)]
        public static extern short GetAsyncKeyState([In] int vKey);

        /// <summary>
        /// Convenient wrapper for the GetAsyncKeyState Win32 function.
        /// </summary>
        public static short GetAsyncKeyState(VirtualKey vKey)
        {
            return GetAsyncKeyState((int)vKey);
        }

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "GetCapture", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern HWND GetCapture();

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "GetClassLong", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern uint GetClassLong(HWND hWnd, ClassLongOffset nIndex);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "GetClassLongPtr", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern UINT_PTR GetClassLongPtr(HWND hWnd, ClassLongPtrOffset nIndex);

        [DllImport(Constants.ModuleNames.USER32, SetLastError = true, EntryPoint = "GetClassNameW", CharSet = CharSet.Unicode)]
        public static extern int GetClassName([In] HWND hWnd, [Out] StringBuilder sb, [In] int nMaxCount);

        /// <summary>
        /// Safe wrapper for the GetClassName Win32 function.
        /// </summary>
        public static string GetClassName(HWND hWnd, int iTryBufferLength = 256)
        {
            StringBuilder sb = new StringBuilder(iTryBufferLength);
            sb.Length = GetClassName(hWnd, sb, sb.Capacity);
            return (sb.Length > 0) ? sb.ToString() : null;
        }

        [DllImport(Constants.ModuleNames.USER32, SetLastError = true)]
        public static extern bool GetClientRect(HWND hWnd, [Out] out RECT lpRect);

        [DllImport(Constants.ModuleNames.USER32, SetLastError = true, EntryPoint = "GetClipboardFormatNameW", CharSet = CharSet.Unicode)]
        public static extern int GetClipboardFormatName(uint format, [Out] StringBuilder lpszFormatName, int cchMaxCount);

        /// <summary>
        /// Safe wrapper for the GetClipboardFormatName Win32 function.
        /// This can also be used to retrieve the name of a registered window message.
        /// </summary>
        public static string GetClipboardFormatName(uint uiFormat, int iTryBufferLength = 256)
        {
            StringBuilder sb = new StringBuilder(iTryBufferLength);
            sb.Length = GetClipboardFormatName(uiFormat, sb, iTryBufferLength);
            return (sb.Length > 0) ? sb.ToString() : null;
        }

        [DllImport(Constants.ModuleNames.USER32, SetLastError = true, EntryPoint = "GetCursorPos")]
        public static extern bool GetCursorPos([Out] out POINT lpPoint);

        /// <summary>
        /// Wrapper for the GetCursorPos Win32 function that throws an exception if it fails.
        /// </summary>
        public static POINT GetCursorPos()
        {
            POINT pt;
            if (!GetCursorPos(out pt))
                throw new Win32Exception();
            return pt;
        }

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "GetDesktopWindow", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern HWND GetDesktopWindow();

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "GetDoubleClickTime", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern uint GetDoubleClickTime();

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "GetGestureInfo", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool GetGestureExtraArgs(
            [In] HGESTUREINFO hGestureInfo,
            [In] uint cbExtraArgs,
            [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] byte[] pExtraArgs);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "GetGestureConfig", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool GetGestureConfig(
            [In] HWND hwnd,
            [In] uint dwReserved,
            [In] GestureConfigFlags dwFlags,
            [In, Out] ref uint pcIDs,
            [In, Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex=4)] GESTURECONFIG[] pGestureConfig,
            [In] uint cbSize);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "GetGestureInfo", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool GetGestureInfo([In] HGESTUREINFO hGestureInfo, [Out] out GESTUREINFO pGestureInfo);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "GetGuiResources", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern uint GetGuiResources([In] HANDLE hProcess, [In] GetGuiResourcesCode uiFlags);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "GetKeyboardState", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool GetKeyboardState([Out, MarshalAs(UnmanagedType.LPArray, SizeConst = 256)] byte[] lpKeyState);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "GetKeyNameTextW", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern int GetKeyNameText(
            [In] int lParam,
            [Out] StringBuilder lpString,
            [In] int cchSize);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "GetKeyState", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern short GetKeyState([In] int nVirtKey);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "GetLastInputInfo", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool GetLastInputInfo([Out] out LASTINPUTINFO plii);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "GetMenu", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern HMENU GetMenu([In] HWND hWnd);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "GetMenuDefaultItem", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern uint GetMenuDefaultItem(
            [In] HMENU hMenu,
            [In, MarshalAs(UnmanagedType.Bool)] bool fByPos = false,
            [In] GetMenuDefaultItemFlags gmdiFlags = 0);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "GetMessageW", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool GetMessage(
            [Out] out MSG lpMsg,
            [In] HWND hwnd,
            [In] WindowMessageId wMsgFilterMin = 0,
            [In] WindowMessageId wMsgFilterMax = 0);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "GetMessageExtraInfo", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern INT_PTR GetMessageExtraInfo();

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "GetMessagePos", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern uint GetMessagePos();

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "GetMonitorInfo", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool GetMonitorInfo(
            [In] HMONITOR hMonitor,
            [In, Out] ref MONITORINFO lpmi);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "GetMonitorInfo", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool GetMonitorInfo(
            [In] HMONITOR hMonitor,
            [In, Out] ref MONITORINFOEX lpmi);

        /// <summary>
        /// Convenient wrapper for the GetMonitorInfo Win32 function that throws an exception on failure.
        /// </summary>
        public static MONITORINFOEX GetMonitorInfo(HMONITOR hMonitor)
        {
            MONITORINFOEX info = new MONITORINFOEX { cbSize = MarshalHelper.SizeOf<MONITORINFOEX>() };
            if (!GetMonitorInfo(hMonitor, ref info))
                throw new Win32Exception();
            return info;
        }

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "GetParent", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern HWND GetParent([In] HWND hWnd);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "GetPhysicalCursorPos", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern bool GetPhysicalCursorPos(out POINT lpPoint);

        /// <summary>
        /// Wrapper for the GetPhysicalCursorPos Win32 function that throws an exception if it fails.
        /// </summary>
        public static POINT GetPhysicalCursorPos()
        {
            POINT pt;
            if (!GetPhysicalCursorPos(out pt))
                throw new Win32Exception();
            return pt;
        }

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "GetProcessWindowStation", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern HWINSTA GetProcessWindowStation();

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "GetRawInputBuffer", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern uint GetRawInputBuffer(
            [In] UINT_PTR pData,
            [In, Out] ref uint pcbSize,
            [In] uint cbSizeHeader);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "GetQueueStatus", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern uint GetQueueStatus(QueueStatusFlags flags);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "GetShellWindow", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern HWND GetShellWindow();

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "GetSubMenu", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern HMENU GetSubMenu([In] HMENU hMenu, [In] int nPos);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "GetThreadDesktop", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern HDESK GetThreadDesktop(uint dwThreadId);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "GetTouchInputInfo", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool GetTouchInputInfo(
            [In] HTOUCHINPUT hTouchInput,
            [In] uint cInputs,
            [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] TOUCHINPUT[] pInputs,
            [In] int cbSize);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "GetUserObjectSecurity", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool GetUserObjectSecurity(
            [In] UINT_PTR hObj,
            [In] ref SECURITY_INFORMATION pSIRequired,
            [In, Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] byte[] pSD,
            [In] uint nLength,
            [Out] out uint lpnLengthNeeded);

        /// <summary>
        /// Convenient wrapper for the GetUserObjectSecurity Win32 function that throws an exception on failure.
        /// </summary>
        /// <returns>An opaque PSECURITY_DESCRIPTOR.</returns>
        public static byte[] GetUserObjectSecurity(UINT_PTR hDesktopOrWinSta, SECURITY_INFORMATION SIRequired)
        {
            while (true)
            {
                uint uiLength = 0;

                /// Get the exact length.
                if (!GetUserObjectSecurity(hDesktopOrWinSta, ref SIRequired, null, 0, out uiLength) &&
                    KERNEL32.GetLastError() != Win32ErrorCode.ERROR_INSUFFICIENT_BUFFER)
                {
                    throw new Win32Exception();
                }

                byte[] pSecurityDescriptor = new byte[uiLength];
                if (GetUserObjectSecurity(hDesktopOrWinSta, ref SIRequired, pSecurityDescriptor, uiLength, out uiLength))
                    return pSecurityDescriptor;
                
                if (KERNEL32.GetLastError() != Win32ErrorCode.ERROR_INSUFFICIENT_BUFFER)
                    throw new Win32Exception();

                /// If the security information grew in between calls, go around for another iteration.
            }
        }

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "GetWindow", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern HWND GetWindow([In] HWND hwnd, [In] GetWindowCode uCmd);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "GetWindowLong", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern int GetWindowLong(HWND hWnd, WindowLongOffset nIndex);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "GetWindowLongPtr", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern INT_PTR GetWindowLongPtr(HWND hWnd, WindowLongPtrOffset nIndex);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "GetWindowModuleFileNameW", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern uint GetWindowModuleFileName(
            [In] HWND hwnd,
            [Out] StringBuilder lpszFileName,
            [In] uint cchFileNameMax);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "GetWindowRect", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool GetWindowRect([In] HWND hWnd, [Out] out RECT lpRect);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "GetWindowTextW", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern int GetWindowText([In] HWND hWnd, [Out] StringBuilder sb, [In] int nMaxCount);

        /// <summary>
        /// Safe wrapper for the GetWindowText Win32 function.
        /// </summary>
        public static string GetWindowText(HWND hWnd)
        {
            StringBuilder sb = new StringBuilder(GetWindowTextLength(hWnd) + 1);
            sb.Length = GetWindowText(hWnd, sb, sb.Capacity);
            return (sb.Length > 0) ? sb.ToString() : null;
        }

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "GetWindowTextLengthW", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern int GetWindowTextLength([In] HWND hWnd);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "GetWindowThreadProcessId", SetLastError = true)]
        public static extern uint GetWindowThreadProcessId([In] HWND hWnd, [Out] out uint lpdwProcessId);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "IsGUIThread", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern bool IsGUIThread(bool bConvert);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "InSendMessage", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool InSendMessage();

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "InSendMessageEx", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern InSendMessageExFlags InSendMessageEx([In] INT_PTR lpReserved = default(INT_PTR));

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "IsWindow", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern bool IsWindow([In] HWND hWnd);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "IsWindowEnabled", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern bool IsWindowEnabled(HWND hWnd);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "IsWindowVisible", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern bool IsWindowVisible([In] HWND hWnd);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "IsWow64Message", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern bool IsWow64Message();

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "keybd_event", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern void keybd_event([In] byte bVk, [In] byte bScan = 0, [In] KeyboardEventFlags dwFlags = 0, [In] int dwExtraInfo = 0);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "KillTimer", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool KillTimer(
            [In] HWND hWnd,
            [In] UINT_PTR nIDEvent);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "LoadKeyboardLayout", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern HKL LoadKeyboardLayout([In] string pwszKLID, [In] KeyboardLayoutFlags Flags);

        /// <summary>
        /// Do not specify zero for the buffer size in this function definition.
        /// </summary>
        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "LoadStringW", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern int LoadString(
            [In] HINSTANCE hInstance,
            [In] uint uID,
            [Out] StringBuilder lpBuffer,
            [In] int nBufferMax);

        /// <summary>
        /// This permits a special usage of LoadString where a direct read-only pointer to
        /// the memory-mapped resource string is returned in the buffer, if the buffer length is given as zero.
        /// This is actually the preferred usage because it doesn't require the caller to make guesses as to how large the preallocated buffer should be.
        /// </summary>
        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "LoadStringW", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern int LoadString(
            HINSTANCE hInstance,
            uint uID,
            out UINT_PTR lpBuffer,
            int nBufferMax = 0);

        /// <summary>
        /// Safe wrapper for the LoadString Win32 function that throws an exception on failure.
        /// </summary>
        /// <returns>null if the resource does not exist</returns>
        public static string LoadString(HINSTANCE hInstance, uint uID)
        {
            UINT_PTR pszString;
            int iLength = LoadString(hInstance, uID, out pszString, 0);
            if (iLength == 0 && KERNEL32.GetLastError() != Win32ErrorCode.ERROR_SUCCESS)
                throw new Win32Exception();

            return Marshal.PtrToStringUni(pszString, iLength);
        }

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "LockSetForegroundWindow", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern bool LockSetForegroundWindow([In] LockSetForegroundWindowType uLockCode);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "MessageBeep", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool MessageBeep(MessageBoxFlags uType = (MessageBoxFlags)0xFFFFFFFF);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "MessageBoxW", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern DialogResultType MessageBox([In] HWND hWnd, string strText, string strCaption = null, MessageBoxFlags uType = MessageBoxFlags.MB_OK);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "MonitorFromPoint", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern HMONITOR MonitorFromPoint([In] POINT pt, [In] DefaultMonitorCode dwFlags = DefaultMonitorCode.MONITOR_DEFAULTTONULL);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "MonitorFromRect", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern HMONITOR MonitorFromRect([In] ref RECT lprc, [In] DefaultMonitorCode dwFlags = DefaultMonitorCode.MONITOR_DEFAULTTONULL);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "MonitorFromWindow", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern HMONITOR MonitorFromWindow([In] HWND hwnd, [In] DefaultMonitorCode dwFlags = DefaultMonitorCode.MONITOR_DEFAULTTONULL);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "MoveWindow", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern bool MoveWindow([In] HWND hWnd, [In] int X, [In] int Y, [In] int nWidth, [In] int nHeight, [In] bool bRepaint);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "MsgWaitForMultipleObjects", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern uint MsgWaitForMultipleObjects([In] uint nCount, [In] HANDLE[] pHandles, bool bWaitAll, uint dwMilliseconds, QueueStatusFlags dwWakeMask);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "MsgWaitForMultipleObjectsEx", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern uint MsgWaitForMultipleObjectsEx([In] uint nCount, [In] HANDLE[] pHandles, uint dwMilliseconds, QueueStatusFlags dwWakeMask, MsgWaitForMultipleObjectsFlags dwFlags);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "OpenDesktopW", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern HDESK OpenDesktop(
            string lpszDesktop,
            DesktopFlags dwFlags = 0,
            bool fInherit = false,
            DesktopAccessRights dwDesiredAccess = DesktopAccessRights.GENERIC_ALL);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "OpenInputDesktop", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern HDESK OpenInputDesktop(
            DesktopFlags dwFlags = 0,
            bool fInherit = false,
            DesktopAccessRights dwDesiredAccess = DesktopAccessRights.GENERIC_ALL);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "OpenWindowStationW", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern HDESK OpenWindowStation(
            string lpszWinSta,
            bool fInherit = false,
            WindowStationAccessRights dwDesiredAccess = WindowStationAccessRights.GENERIC_ALL);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "PeekMessageW", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern bool PeekMessage([Out] out MSG lpMsg, HWND hWnd, WindowMessageId wMsgFilterMin, WindowMessageId wMsgFilterMax, PeekMessageRemoveFlags wRemoveMsgs);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "PhysicalToLogicalPoint", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern bool PhysicalToLogicalPoint(HWND hWnd, ref POINT lpPoint);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "PostMessageW", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern bool PostMessage(
            [In] HWND hwnd,
            [In] WindowMessageId Msg = WindowMessageId.WM_NULL,
            [In] UINT_PTR wParam = default(UINT_PTR),
            [In] INT_PTR lParam = default(INT_PTR));

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "PostThreadMessageW", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern bool PostThreadMessage(
            [In] UINT_PTR idThread,
            [In] WindowMessageId Msg = WindowMessageId.WM_NULL,
            [In] UINT_PTR wParam = default(UINT_PTR),
            [In] INT_PTR lParam = default(INT_PTR));

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "PtInRect", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern bool PtInRect([In] ref RECT lprc, [In] POINT pt);

        /// <summary>
        /// Retrieves a handle to the child window at the specified point. The search is restricted to immediate child windows; grandchildren and deeper descendant windows are not searched.
        /// </summary>
        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "RealChildWindowFromPoint", SetLastError = true)]
        public static extern HWND RealChildWindowFromPoint(HWND hwndParent, POINT Point);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "RegisterHotKey", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool RegisterHotKey(
            [In] HWND hWnd,
            [In] int id,
            [In] HotKeyModifiers fsModifiers,
            [In] uint vk);

        /// <summary>
        /// Convenient wrapper for the Win32 RegisterHotKey API that recasts the virtual key to the more usable enum.
        /// </summary>
        public static bool RegisterHotKey(
            [In] HWND hWnd,
            [In] int id,
            [In] HotKeyModifiers fsModifiers,
            [In] VirtualKey vk)
        {
            return RegisterHotKey(hWnd, id, fsModifiers, (uint)vk);
        }

        /// <summary>
        /// Undocumented.
        /// </summary>
        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "RegisterShellHookWindow", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern void RegisterShellHookWindow(HWND hwnd);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "RegisterTouchWindow", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool RegisterTouchWindow([In] HWND hWnd, [In] TouchWindowFlags ulFlags);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "RegisterWindowMessageW", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern WindowMessageId RegisterWindowMessage([In] string lpString);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "ReleaseCapture", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern bool ReleaseCapture();

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "ReplyMessage", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern bool ReplyMessage([In] INT_PTR lResult);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "ScreenToClient", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool ScreenToClient(HWND hWnd, ref POINT lpPoint);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "SendMessageW", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern INT_PTR SendMessage(
            [In] HWND hwnd,
            [In] WindowMessageId Msg = WindowMessageId.WM_NULL,
            [In] UINT_PTR wParam = default(UINT_PTR),
            [In] INT_PTR lParam = default(INT_PTR));

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "SendMessageCallbackW", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool SendMessageCallback(
            [In] HWND hwnd,
            [In] WindowMessageId Msg,
            [In] UINT_PTR wParam,
            [In] INT_PTR lParam,
            [In, MarshalAs(UnmanagedType.FunctionPtr)] SENDASYNCPROC lpCallback,
            [In] UINT_PTR dwData = default(UINT_PTR));

        /// <summary>
        /// Convenient wrapper for the Win32 SendMessageCallback API that reorders the parameters and provides full default values, to allow unnecessary ones to be completely ignored.
        /// </summary>
        public static bool SendMessageCallback(HWND hwnd, SENDASYNCPROC lpCallback, UINT_PTR dwData = default(UINT_PTR), WindowMessageId Msg = WindowMessageId.WM_NULL, UINT_PTR wParam = default(UINT_PTR), INT_PTR lParam = default(INT_PTR))
        {
            //return SendMessageCallback(hwnd, (hwnd2, uMsg, dwData2, lResult) => MessageBox(hwnd2, "WAZZAAAP"));
            return SendMessageCallback(hwnd, Msg, wParam, lParam, lpCallback, dwData);
        }

        /// <summary>
        /// This function essentially does a SendMessage() if the target window is on the same thread,
        /// and a PostMessage() if it is not.
        /// </summary>
        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "SendNotifyMessageW", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern bool SendNotifyMessage(
            [In] HWND hwnd,
            [In] WindowMessageId Msg = WindowMessageId.WM_NULL,
            [In] UINT_PTR wParam = default(UINT_PTR),
            [In] INT_PTR lParam = default(INT_PTR));

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "SetActiveWindow", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern HWND SetActiveWindow(HWND hWnd);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "SetCapture", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern HWND SetCapture(HWND hWnd);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "SetClassLong", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern uint SetClassLong(HWND hWnd, ClassLongOffset nIndex, int dwNewLong);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "SetClassLongPtr", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern UINT_PTR SetClassLongPtr(HWND hWnd, ClassLongPtrOffset nIndex, INT_PTR dwNewLong);

        /// <summary>
        /// Moves the cursor to the specified screen coordinates.
        /// If the new coordinates are not within the screen rectangle set by the most recent ClipCursor function call, the system automatically adjusts the coordinates so that the cursor stays within the rectangle.
        /// </summary>
        /// <remarks>
        /// The cursor is a shared resource. A window should move the cursor only when the cursor is in the window's client area.
        /// The calling process must have WINSTA_WRITEATTRIBUTES access to the window station.
        /// The input desktop must be the current desktop when you call SetCursorPos. Call OpenInputDesktop to determine whether the current desktop is the input desktop. If it is not, call SetThreadDesktop with the HDESK returned by OpenInputDesktop to switch to that desktop.
        /// </remarks>
        [DllImport(Constants.ModuleNames.USER32, SetLastError = true)]
        public static extern bool SetCursorPos([In] int X, [In] int Y);

        /// <summary>
        /// Convenient wrapper for the Win32 SetCursorPos function that accepts a POINT instead of two integers.
        /// </summary>
        public static bool SetCursorPos(POINT pt)
        {
            return SetCursorPos(pt.x, pt.y);
        }

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "SetForegroundWindow", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern bool SetForegroundWindow(HWND hwnd);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "SetGestureConfig", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern bool SetGestureConfig(
            [In] HWND hwnd,
            [In] uint dwReserved,
            [In] uint cIDs,
            [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] GESTURECONFIG[] pGestureConfig,
            [In] uint cbSize);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "SetKeyboardState", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern bool SetKeyboardState([In, MarshalAs(UnmanagedType.LPArray, SizeConst = 256)] byte[] lpKeyState);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "SetMenu", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern bool SetMenu([In] HWND hWnd, [In] HMENU hMenu = default(HMENU));

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "SetMessageExtraInfo", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern INT_PTR SetMessageExtraInfo(INT_PTR lParam);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "SetParent", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern HWND SetParent([In] HWND hWnd, [In] HWND hWndNewParent);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "SetPhysicalCursorPos", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern bool SetPhysicalCursorPos(int X, int Y);

        /// <summary>
        /// Convenient wrapper for the Win32 SetPhysicalCursorPos function that accepts a POINT instead of two integers.
        /// </summary>
        public static bool SetPhysicalCursorPos(POINT pt)
        {
            return SetPhysicalCursorPos(pt.x, pt.y);
        }

        [DllImport(Constants.ModuleNames.USER32, SetLastError = true, EntryPoint = "SetProcessWindowStation", CharSet = CharSet.Unicode)]
        public static extern bool SetProcessWindowStation([In] HWINSTA hDesktop);

        /// <summary>
        /// Undocumented.
        /// </summary>
        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "SetShellWindow", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern int SetShellWindow(HWND hWnd);

        /// <summary>
        /// Undocumented.
        /// </summary>
        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "SetShellWindowEx", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern int SetShellWindowEx(HWND hWnd, HWND hChild);

        /// <summary>
        /// Undocumented.
        /// </summary>
        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "SetTaskmanWindow", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern void SetTaskmanWindow(HWND hWnd);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "SetThreadDesktop", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool SetThreadDesktop(HDESK hDesktop);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "SetTimer", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern UINT_PTR SetTimer(
            [In] HWND hWnd,
            [In] UINT_PTR nIDEvent,
            [In] uint uElapse,
            [In, MarshalAs(UnmanagedType.FunctionPtr)] TIMERPROC lpTimerFunc = null);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "SetWindowLong", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern int SetWindowLong(HWND hWnd, WindowLongOffset nIndex, int dwNewLong);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "SetWindowLongPtr", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern INT_PTR SetWindowLongPtr(HWND hWnd, WindowLongPtrOffset nIndex, INT_PTR dwNewLong);

        /// <summary>
        /// Changes the size, position, and Z order of a child, pop-up, or top-level window. These windows are ordered according to their appearance on the screen. The topmost window receives the highest rank and is the first window in the Z order.
        /// </summary>
        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "SetWindowPos", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern bool SetWindowPos(
            [In] HWND hwnd,
            [In] HWND hwndInsertAfter = default(HWND),
            [In] int x = -1,
            [In] int y = -1,
            [In] int width = -1,
            [In] int height = -1,
            [In] SetWindowPosFlags flags = SetWindowPosFlags.SWP_NOMOVE | SetWindowPosFlags.SWP_NOREPOSITION | SetWindowPosFlags.SWP_NOZORDER);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "SetWindowTextW", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern bool SetWindowText([In] HWND hWnd, [In] string lpString = null);

        /// <summary>
        /// The raw original form of the Win32 SetWindowsHookEx function.
        /// http://msdn.microsoft.com/en-us/library/ms644990(VS.85).aspx
        /// </summary>
        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "SetWindowsHookExW", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern HHOOK SetWindowsHookEx(HookId hookid, Delegate pfnhook, HINSTANCE hinst = default(HINSTANCE), uint threadid = 0);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "SetWinEventHook", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern HWINEVENTHOOK SetWinEventHook(
            [In] WinEventCode eventMin,
            [In] WinEventCode eventMax,
            [In] HINSTANCE hmodWinEventProc,
            [In] WINEVENTPROC lpfnWinEventProc,
            [In] uint idProcess,
            [In] uint idThread,
            [In] SetWinEventHookFlags dwflags);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "ShowCursor", SetLastError = true)]
        public static extern int ShowCursor([In, MarshalAs(UnmanagedType.Bool)] bool bShow = true);

        /// This function is effectively ignored the first time it is called in a process,
        /// <summary>
        /// if the process that launched the application provides a STARTUPINFO structure.
        /// Otherwise, the first time ShowWindow is called, the nCmdShow value should be the value obtained by the WinMain function in its nCmdShow parameter.
        /// </summary>
        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "ShowWindow", SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool ShowWindow([In] HWND hWnd, [In] ShowWindowCommand nCmdShow = ShowWindowCommand.SW_SHOW);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "SwitchDesktop", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool SwitchDesktop([In] HDESK hDesktop);

        /// <summary>
        /// Undocumented.
        /// </summary>
        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "SwitchToThisWindow", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern void SwitchToThisWindow(HWND hwnd, int i);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "UnhookWindowsHookEx", CharSet = CharSet.Unicode, SetLastError = true, CallingConvention = CallingConvention.Winapi)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool UnhookWindowsHookEx([In] UINT_PTR hhook);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "UnhookWinEvent", CharSet = CharSet.Unicode, SetLastError = true, CallingConvention = CallingConvention.Winapi)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool UnhookWinEvent([In] HWINEVENTHOOK hWinEventHook);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "UnloadKeyboardLayout", CharSet = CharSet.Unicode, SetLastError = true, CallingConvention = CallingConvention.Winapi)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool UnloadKeyboardLayout([In] UINT_PTR hkl);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "UnregisterHotKey", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool UnregisterHotKey(
            [In] HWND hWnd,
            [In] int id);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "UnregisterTouchWindow", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool UnregisterTouchWindow([In] HWND hWnd);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "WaitForInputIdle", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern uint WaitForInputIdle(
            [In] HANDLE hProcess,
            [Out] uint dwMilliseconds);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "WaitMessage", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool WaitMessage();

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "WindowFromPoint", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        public static extern HWND WindowFromPoint(POINT pt);

        [DllImport(Constants.ModuleNames.USER32, EntryPoint = "WinHelpW", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool WinHelp(
            [In] HWND hWndMain,
            string lpszHelp,
            WinHelpCommand uCommand = WinHelpCommand.HELP_CONTENTS,
            UINT_PTR dwData = default(UINT_PTR));
    }
}

/****
ActivateKeyboardLayout 1
AdjustWindowRect 2
AdjustWindowRectEx 3
AlignRects 4
AllowForegroundActivation 5
AllowSetForegroundWindow 6
AnimateWindow 7
AnyPopup 8
AppendMenuA 9
AppendMenuW 10
ArrangeIconicWindows 11
AttachThreadInput 12
BeginDeferWindowPos 13
BeginPaint 14
BlockInput 15
BringWindowToTop 16
BroadcastSystemMessage 17
BroadcastSystemMessageA 18
BroadcastSystemMessageExA 19
BroadcastSystemMessageExW 20
BroadcastSystemMessageW 21
BuildReasonArray 22
CalcMenuBar 23
CallMsgFilter 24
CallMsgFilterA 25
CallMsgFilterW 26
CallNextHookEx 27
CallWindowProcA 28
CallWindowProcW 29
CascadeChildWindows 30
CascadeWindows 31
ChangeClipboardChain 32
ChangeDisplaySettingsA 33
ChangeDisplaySettingsExA 34
ChangeDisplaySettingsExW 35
ChangeDisplaySettingsW 36
ChangeMenuA 37
ChangeMenuW 38
CharLowerA 39
CharLowerBuffA 40
CharLowerBuffW 41
CharLowerW 42
CharNextA 43
CharNextExA 44
CharNextW 45
CharPrevA 46
CharPrevExA 47
CharPrevW 48
CharToOemA 49
CharToOemBuffA 50
CharToOemBuffW 51
CharToOemW 52
CharUpperA 53
CharUpperBuffA 54
CharUpperBuffW 55
CharUpperW 56
CheckDlgButton 57
CheckMenuItem 58
CheckMenuRadioItem 59
CheckRadioButton 60
ChildWindowFromPoint 61
ChildWindowFromPointEx 62
CliImmSetHotKey 63
ClientThreadSetup 64
ClientToScreen 65
ClipCursor 66
CloseClipboard 67
CloseDesktop 68
CloseWindow 69
CloseWindowStation 70
CopyAcceleratorTableA 71
CopyAcceleratorTableW 72
CopyIcon 73
CopyImage 74
CopyRect 75
CountClipboardFormats 76
CreateAcceleratorTableA 77
CreateAcceleratorTableW 78
CreateCaret 79
CreateCursor 80
CreateDesktopA 81
CreateDesktopW 82
CreateDialogIndirectParamA 83
CreateDialogIndirectParamAorW 84
CreateDialogIndirectParamW 85
CreateDialogParamA 86
CreateDialogParamW 87
CreateIcon 88
CreateIconFromResource 89
CreateIconFromResourceEx 90
CreateIconIndirect 91
CreateMDIWindowA 92
CreateMDIWindowW 93
CreateMenu 94
CreatePopupMenu 95
CreateSystemThreads 96
CreateWindowExA 97
CreateWindowExW 98
CreateWindowStationA 99
CreateWindowStationW 100
CsrBroadcastSystemMessageExW 101
CtxInitUser32 102
DdeAbandonTransaction 103
DdeAccessData 104
DdeAddData 105
DdeClientTransaction 106
DdeCmpStringHandles 107
DdeConnect 108
DdeConnectList 109
DdeCreateDataHandle 110
DdeCreateStringHandleA 111
DdeCreateStringHandleW 112
DdeDisconnect 113
DdeDisconnectList 114
DdeEnableCallback 115
DdeFreeDataHandle 116
DdeFreeStringHandle 117
DdeGetData 118
DdeGetLastError 119
DdeGetQualityOfService 120
DdeImpersonateClient 121
DdeInitializeA 122
DdeInitializeW 123
DdeKeepStringHandle 124
DdeNameService 125
DdePostAdvise 126
DdeQueryConvInfo 127
DdeQueryNextServer 128
DdeQueryStringA 129
DdeQueryStringW 130
DdeReconnect 131
DdeSetQualityOfService 132
DdeSetUserHandle 133
DdeUnaccessData 134
DdeUninitialize 135
DefDlgProcA 136
DefDlgProcW 137
DefFrameProcA 138
DefFrameProcW 139
DefMDIChildProcA 140
DefMDIChildProcW 141
DefRawInputProc 142
DefWindowProcA 143
DefWindowProcW 144
DeferWindowPos 145
DeleteMenu 146
DeregisterShellHookWindow 147
DestroyAcceleratorTable 148
DestroyCaret 149
DestroyCursor 150
DestroyIcon 151
DestroyMenu 152
DestroyReasons 153
DestroyWindow 154
DeviceEventWorker 155
DialogBoxIndirectParamA 156
DialogBoxIndirectParamAorW 157
DialogBoxIndirectParamW 158
DialogBoxParamA 159
DialogBoxParamW 160
DisableProcessWindowsGhosting 161
DispatchMessageA 162
DispatchMessageW 163
DisplayExitWindowsWarnings 164
DlgDirListA 165
DlgDirListComboBoxA 166
DlgDirListComboBoxW 167
DlgDirListW 168
DlgDirSelectComboBoxExA 169
DlgDirSelectComboBoxExW 170
DlgDirSelectExA 171
DlgDirSelectExW 172
DragDetect 173
DragObject 174
DrawAnimatedRects 175
DrawCaption 176
DrawCaptionTempA 177
DrawCaptionTempW 178
DrawEdge 179
DrawFocusRect 180
DrawFrame 181
DrawFrameControl 182
DrawIcon 183
DrawIconEx 184
DrawMenuBar 185
DrawMenuBarTemp 186
DrawStateA 187
DrawStateW 188
DrawTextA 189
DrawTextExA 190
DrawTextExW 191
DrawTextW 192
EditWndProc 193
EmptyClipboard 194
EnableMenuItem 195
EnableScrollBar 196
EnableWindow 197
EndDeferWindowPos 198
EndDialog 199
EndMenu 200
EndPaint 201
EndTask 202
EnterReaderModeHelper 203
EnumChildWindows 204
EnumClipboardFormats 205
EnumDesktopWindows 206
EnumDesktopsA 207
EnumDesktopsW 208
EnumDisplayDevicesA 209
EnumDisplayDevicesW 210
EnumDisplayMonitors 211
EnumDisplaySettingsA 212
EnumDisplaySettingsExA 213
EnumDisplaySettingsExW 214
EnumDisplaySettingsW 215
EnumPropsA 216
EnumPropsExA 217
EnumPropsExW 218
EnumPropsW 219
EnumThreadWindows 220
EnumWindowStationsA 221
EnumWindowStationsW 222
EnumWindows 223
EqualRect 224
ExcludeUpdateRgn 225
ExitWindowsEx 226
FillRect 227
FindWindowA 228
FindWindowExA 229
FindWindowExW 230
FindWindowW 231
FlashWindow 232
FlashWindowEx 233
FrameRect 234
FreeDDElParam 235
GetActiveWindow 236
GetAltTabInfo 237
GetAltTabInfoA 238
GetAltTabInfoW 239
GetAncestor 240
GetAppCompatFlags 242
GetAppCompatFlags2 241
GetAsyncKeyState 243
GetCapture 244
GetCaretBlinkTime 245
GetCaretPos 246
GetClassInfoA 247
GetClassInfoExA 248
GetClassInfoExW 249
GetClassInfoW 250
GetClassLongA 251
GetClassLongW 252
GetClassNameA 253
GetClassNameW 254
GetClassWord 255
GetClientRect 256
GetClipCursor 257
GetClipboardData 258
GetClipboardFormatNameA 259
GetClipboardFormatNameW 260
GetClipboardOwner 261
GetClipboardSequenceNumber 262
GetClipboardViewer 263
GetComboBoxInfo 264
GetCursor 265
GetCursorFrameInfo 266
GetCursorInfo 267
GetCursorPos 268
GetDC 269
GetDCEx 270
GetDesktopWindow 271
GetDialogBaseUnits 272
GetDlgCtrlID 273
GetDlgItem 274
GetDlgItemInt 275
GetDlgItemTextA 276
GetDlgItemTextW 277
GetDoubleClickTime 278
GetFocus 279
GetForegroundWindow 280
GetGUIThreadInfo 281
GetGuiResources 282
GetIconInfo 283
GetInputDesktop 284
GetInputState 285
GetInternalWindowPos 286
GetKBCodePage 287
GetKeyNameTextA 288
GetKeyNameTextW 289
GetKeyState 290
GetKeyboardLayout 291
GetKeyboardLayoutList 292
GetKeyboardLayoutNameA 293
GetKeyboardLayoutNameW 294
GetKeyboardState 295
GetKeyboardType 296
GetLastActivePopup 297
GetLastInputInfo 298
GetLayeredWindowAttributes 299
GetListBoxInfo 300
GetMenu 301
GetMenuBarInfo 302
GetMenuCheckMarkDimensions 303
GetMenuContextHelpId 304
GetMenuDefaultItem 305
GetMenuInfo 306
GetMenuItemCount 307
GetMenuItemID 308
GetMenuItemInfoA 309
GetMenuItemInfoW 310
GetMenuItemRect 311
GetMenuState 312
GetMenuStringA 313
GetMenuStringW 314
GetMessageA 315
GetMessageExtraInfo 316
GetMessagePos 317
GetMessageTime 318
GetMessageW 319
GetMonitorInfoA 320
GetMonitorInfoW 321
GetMouseMovePointsEx 322
GetNextDlgGroupItem 323
GetNextDlgTabItem 324
GetOpenClipboardWindow 325
GetParent 326
GetPriorityClipboardFormat 327
GetProcessDefaultLayout 328
GetProcessWindowStation 329
GetProgmanWindow 330
GetPropA 331
GetPropW 332
GetQueueStatus 333
GetRawInputBuffer 334
GetRawInputData 335
GetRawInputDeviceInfoA 336
GetRawInputDeviceInfoW 337
GetRawInputDeviceList 338
GetReasonTitleFromReasonCode 339
GetRegisteredRawInputDevices 340
GetScrollBarInfo 341
GetScrollInfo 342
GetScrollPos 343
GetScrollRange 344
GetShellWindow 345
GetSubMenu 346
GetSysColor 347
GetSysColorBrush 348
GetSystemMenu 349
GetSystemMetrics 350
GetTabbedTextExtentA 351
GetTabbedTextExtentW 352
GetTaskmanWindow 353
GetThreadDesktop 354
GetTitleBarInfo 355
GetTopWindow 356
GetUpdateRect 357
GetUpdateRgn 358
GetUserObjectInformationA 359
GetUserObjectInformationW 360
GetUserObjectSecurity 361
GetWinStationInfo 362
GetWindow 363
GetWindowContextHelpId 364
GetWindowDC 365
GetWindowInfo 366
GetWindowLongA 367
GetWindowLongW 368
GetWindowModuleFileName 369
GetWindowModuleFileNameA 370
GetWindowModuleFileNameW 371
GetWindowPlacement 372
GetWindowRect 373
GetWindowRgn 374
GetWindowRgnBox 375
GetWindowTextA 376
GetWindowTextLengthA 377
GetWindowTextLengthW 378
GetWindowTextW 379
GetWindowThreadProcessId 380
GetWindowWord 381
GrayStringA 382
GrayStringW 383
HideCaret 384
HiliteMenuItem 385
IMPGetIMEA 386
IMPGetIMEW 387
IMPQueryIMEA 388
IMPQueryIMEW 389
IMPSetIMEA 390
IMPSetIMEW 391
ImpersonateDdeClientWindow 392
InSendMessage 393
InSendMessageEx 394
InflateRect 395
InitializeLpkHooks 396
InitializeWin32EntryTable 397
InsertMenuA 398
InsertMenuItemA 399
InsertMenuItemW 400
InsertMenuW 401
InternalGetWindowText 402
IntersectRect 403
InvalidateRect 404
InvalidateRgn 405
InvertRect 406
IsCharAlphaA 407
IsCharAlphaNumericA 408
IsCharAlphaNumericW 409
IsCharAlphaW 410
IsCharLowerA 411
IsCharLowerW 412
IsCharUpperA 413
IsCharUpperW 414
IsChild 415
IsClipboardFormatAvailable 416
IsDialogMessage 417
IsDialogMessageA 418
IsDialogMessageW 419
IsDlgButtonChecked 420
IsGUIThread 421
IsHungAppWindow 422
IsIconic 423
IsMenu 424
IsRectEmpty 425
IsServerSideWindow 426
IsWinEventHookInstalled 427
IsWindow 428
IsWindowEnabled 429
IsWindowInDestroy 430
IsWindowUnicode 431
IsWindowVisible 432
IsZoomed 433
KillSystemTimer 434
KillTimer 435
LoadAcceleratorsA 436
LoadAcceleratorsW 437
LoadBitmapA 438
LoadBitmapW 439
LoadCursorA 440
LoadCursorFromFileA 441
LoadCursorFromFileW 442
LoadCursorW 443
LoadIconA 444
LoadIconW 445
LoadImageA 446
LoadImageW 447
LoadKeyboardLayoutA 448
LoadKeyboardLayoutEx 449
LoadKeyboardLayoutW 450
LoadLocalFonts 451
LoadMenuA 452
LoadMenuIndirectA 453
LoadMenuIndirectW 454
LoadMenuW 455
LoadRemoteFonts 456
LoadStringA 457
LoadStringW 458
LockSetForegroundWindow 459
LockWindowStation 460
LockWindowUpdate 461
LockWorkStation 462
LookupIconIdFromDirectory 463
LookupIconIdFromDirectoryEx 464
MBToWCSEx 465
MB_GetString 466
MapDialogRect 467
MapVirtualKeyA 468
MapVirtualKeyExA 469
MapVirtualKeyExW 470
MapVirtualKeyW 471
MapWindowPoints 472
MenuItemFromPoint 473
MenuWindowProcA 474
MenuWindowProcW 475
MessageBeep 476
MessageBoxA 477
MessageBoxExA 478
MessageBoxExW 479
MessageBoxIndirectA 480
MessageBoxIndirectW 481
MessageBoxTimeoutA 482
MessageBoxTimeoutW 483
MessageBoxW 484
ModifyMenuA 485
ModifyMenuW 486
MonitorFromPoint 487
MonitorFromRect 488
MonitorFromWindow 489
MoveWindow 490
MsgWaitForMultipleObjects 491
MsgWaitForMultipleObjectsEx 492
NotifyWinEvent 493
OemKeyScan 494
OemToCharA 495
OemToCharBuffA 496
OemToCharBuffW 497
OemToCharW 498
OffsetRect 499
OpenClipboard 500
OpenDesktopA 501
OpenDesktopW 502
OpenIcon 503
OpenInputDesktop 504
OpenWindowStationA 505
OpenWindowStationW 506
PackDDElParam 507
PaintDesktop 508
PaintMenuBar 509
PeekMessageA 510
PeekMessageW 511
PostMessageA 512
PostMessageW 513
PostQuitMessage 514
PostThreadMessageA 515
PostThreadMessageW 516
PrintWindow 517
PrivateExtractIconExA 518
PrivateExtractIconExW 519
PrivateExtractIconsA 520
PrivateExtractIconsW 521
PrivateSetDbgTag 522
PrivateSetRipFlags 523
PtInRect 524
QuerySendMessage 525
QueryUserCounters 526
RealChildWindowFromPoint 527
RealGetWindowClass 528
RealGetWindowClassA 529
RealGetWindowClassW 530
ReasonCodeNeedsBugID 531
ReasonCodeNeedsComment 532
RecordShutdownReason 533
RedrawWindow 534
RegisterClassA 535
RegisterClassExA 536
RegisterClassExW 537
RegisterClassW 538
RegisterClipboardFormatA 539
RegisterClipboardFormatW 540
RegisterDeviceNotificationA 541
RegisterDeviceNotificationW 542
RegisterHotKey 543
RegisterLogonProcess 544
RegisterMessagePumpHook 545
RegisterRawInputDevices 546
RegisterServicesProcess 547
RegisterShellHookWindow 548
RegisterSystemThread 549
RegisterTasklist 550
RegisterUserApiHook 551
RegisterWindowMessageA 552
RegisterWindowMessageW 553
ReleaseCapture 554
ReleaseDC 555
RemoveMenu 556
RemovePropA 557
RemovePropW 558
ReplyMessage 559
ResolveDesktopForWOW 560
ReuseDDElParam 561
ScreenToClient 562
ScrollChildren 563
ScrollDC 564
ScrollWindow 565
ScrollWindowEx 566
SendDlgItemMessageA 567
SendDlgItemMessageW 568
SendIMEMessageExA 569
SendIMEMessageExW 570
SendInput 571
SendMessageA 572
SendMessageCallbackA 573
SendMessageCallbackW 574
SendMessageTimeoutA 575
SendMessageTimeoutW 576
SendMessageW 577
SendNotifyMessageA 578
SendNotifyMessageW 579
SetActiveWindow 580
SetCapture 581
SetCaretBlinkTime 582
SetCaretPos 583
SetClassLongA 584
SetClassLongW 585
SetClassWord 586
SetClipboardData 587
SetClipboardViewer 588
SetConsoleReserveKeys 589
SetCursor 590
SetCursorContents 591
SetCursorPos 592
SetDebugErrorLevel 593
SetDeskWallpaper 594
SetDlgItemInt 595
SetDlgItemTextA 596
SetDlgItemTextW 597
SetDoubleClickTime 598
SetFocus 599
SetForegroundWindow 600
SetInternalWindowPos 601
SetKeyboardState 602
SetLastErrorEx 603
SetLayeredWindowAttributes 604
SetLogonNotifyWindow 605
SetMenu 606
SetMenuContextHelpId 607
SetMenuDefaultItem 608
SetMenuInfo 609
SetMenuItemBitmaps 610
SetMenuItemInfoA 611
SetMenuItemInfoW 612
SetMessageExtraInfo 613
SetMessageQueue 614
SetParent 615
SetProcessDefaultLayout 616
SetProcessWindowStation 617
SetProgmanWindow 618
SetPropA 619
SetPropW 620
SetRect 621
SetRectEmpty 622
SetScrollInfo 623
SetScrollPos 624
SetScrollRange 625
SetShellWindow 626
SetShellWindowEx 627
SetSysColors 628
SetSysColorsTemp 629
SetSystemCursor 630
SetSystemMenu 631
SetSystemTimer 632
SetTaskmanWindow 633
SetThreadDesktop 634
SetTimer 635
SetUserObjectInformationA 636
SetUserObjectInformationW 637
SetUserObjectSecurity 638
SetWinEventHook 639
SetWindowContextHelpId 640
SetWindowLongA 641
SetWindowLongW 642
SetWindowPlacement 643
SetWindowPos 644
SetWindowRgn 645
SetWindowStationUser 646
SetWindowTextA 647
SetWindowTextW 648
SetWindowWord 649
SetWindowsHookA 650
SetWindowsHookExA 651
SetWindowsHookExW 652
SetWindowsHookW 653
ShowCaret 654
ShowCursor 655
ShowOwnedPopups 656
ShowScrollBar 657
ShowStartGlass 658
ShowWindow 659
ShowWindowAsync 660
SoftModalMessageBox 661
SubtractRect 662
SwapMouseButton 663
SwitchDesktop 664
SwitchToThisWindow 665
SystemParametersInfoA 666
SystemParametersInfoW 667
TabbedTextOutA 668
TabbedTextOutW 669
TileChildWindows 670
TileWindows 671
ToAscii 672
ToAsciiEx 673
ToUnicode 674
ToUnicodeEx 675
TrackMouseEvent 676
TrackPopupMenu 677
TrackPopupMenuEx 678
TranslateAccelerator 679
TranslateAcceleratorA 680
TranslateAcceleratorW 681
TranslateMDISysAccel 682
TranslateMessage 683
TranslateMessageEx 684
UnhookWinEvent 685
UnhookWindowsHook 686
UnhookWindowsHookEx 687
UnionRect 688
UnloadKeyboardLayout 689
UnlockWindowStation 690
UnpackDDElParam 691
UnregisterClassA 692
UnregisterClassW 693
UnregisterDeviceNotification 694
UnregisterHotKey 695
UnregisterMessagePumpHook 696
UnregisterUserApiHook 697
UpdateLayeredWindow 698
UpdatePerUserSystemParameters 699
UpdateWindow 700
User32InitializeImmEntryTable 701
UserClientDllInitialize 702
UserHandleGrantAccess 703
UserLpkPSMTextOut 704
UserLpkTabbedTextOut 705
UserRealizePalette 706
UserRegisterWowHandlers 707
VRipOutput 708
VTagOutput 709
ValidateRect 710
ValidateRgn 711
VkKeyScanA 712
VkKeyScanExA 713
VkKeyScanExW 714
VkKeyScanW 715
WCSToMBEx 716
WINNLSEnableIME 717
WINNLSGetEnableStatus 718
WINNLSGetIMEHotkey 719
WaitForInputIdle 720
WaitMessage 721
Win32PoolAllocationStats 722
WinHelpA 723
WinHelpW 724
WindowFromDC 725
WindowFromPoint 726
keybd_event 727
mouse_event 728
wsprintfA 729
wsprintfW 730
wvsprintfA 731
wvsprintfW 732
****/